<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- start: Meta -->
    <meta charset="utf-8">
    <title>祥安消防系统</title>
    <meta name="description" content="Bootstrap Metro Dashboard">
    <meta name="author" content="Dennis Ji">
    <meta name="keyword"
          content="Metro, Metro UI, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <!-- end: Meta -->

    <!-- start: Mobile Specific -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- end: Mobile Specific -->

    <!-- start: CSS -->
    <link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
    <link id="base-style" href="css/style.css" rel="stylesheet">
    <link id="base-style-responsive" href="css/style-responsive.css"
          rel="stylesheet">
    <link
            href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext'
            rel='stylesheet' type='text/css'>
    <!-- end: CSS -->


    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <link id="ie-style" href="css/ie.css" rel="stylesheet">
    <![endif]-->

    <!--[if IE 9]>
    <link id="ie9style" href="css/ie9.css" rel="stylesheet">
    <![endif]-->

    <!-- start: Favicon -->
    <link rel="shortcut icon" href="img/favicon.ico">
    <!-- end: Favicon -->




</head>
<body>
<!-- start: JavaScript-->

<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery-migrate-1.0.0.min.js"></script>

<script src="js/jquery-ui-1.10.0.custom.min.js"></script>

<script src="js/jquery.ui.touch-punch.js"></script>

<script src="js/modernizr.js"></script>

<script src="js/bootstrap.min.js"></script>

<script src="js/jquery.cookie.js"></script>

<script src='js/fullcalendar.min.js'></script>

<script src='js/jquery.dataTables.min.js'></script>

<script src="js/excanvas.js"></script>
<script src="js/jquery.flot.js"></script>
<script src="js/jquery.flot.pie.js"></script>
<script src="js/jquery.flot.stack.js"></script>
<script src="js/jquery.flot.resize.min.js"></script>

<script src="js/jquery.chosen.min.js"></script>

<script src="js/jquery.uniform.min.js"></script>

<script src="js/jquery.cleditor.min.js"></script>

<script src="js/jquery.noty.js"></script>

<script src="js/jquery.elfinder.min.js"></script>

<script src="js/jquery.raty.min.js"></script>

<script src="js/jquery.iphone.toggle.js"></script>

<script src="js/jquery.uploadify-3.1.min.js"></script>

<script src="js/jquery.gritter.min.js"></script>

<script src="js/jquery.imagesloaded.js"></script>

<script src="js/jquery.masonry.min.js"></script>

<script src="js/jquery.knob.modified.js"></script>

<script src="js/jquery.sparkline.min.js"></script>

<script src="js/counter.js"></script>

<script src="js/retina.js"></script>

<script src="js/custom.js"></script>

<script>


    function submitQuestion() {


        $("#questionForm").submit();

        var pare=window.opener;


        if(pare!=null)
        {

            var $what=$(pare.document.getElementById("company"));



            if($what!=null) {
                var name = $what.find("option:selected");

                var $tbody=$(pare.document.getElementById("tablebody"));

                $.post("${pageContext.request.contextPath}/questionAction", {company:name.val(),type:$("#type").val()},
                    function(data){
                        alert(data)
                        //tbody清空
                        $tbody.empty();
                        //4 返回json数组对象,对其遍历
                        $.each( data, function(i, json){
                            // 每次遍历创建一个option对象
                            var $tr = $("<tr><td>"+json["questionName"]+"</td><td class='center'>"+json["insertTime"]+"</td>" +
                                "<td class='center'>"+json["dutyPeople"]+"</td><td class='center'>"+json["isfinish"]+"</td>" +
                                "<td class=\"center\">\n" +
                                "                                                <a class=\"btn btn-info\" " +
                                "href=\"${pageContext.request.contextPath}/Ques_editQuestion?questionId="+json["id"]+"\">\n" +
                                "                                                    <i class=\"halflings-icon white edit\"></i>\n" +
                                "                                                </a>\n" +
                                "                                                <a class=\"btn btn-danger\" " +
                                "href=\"${pageContext.request.contextPath}/Ques_deleteQuestion?questionId="+json["id"]+"\">\n" +
                                "                                                    <i class=\"halflings-icon white trash\"></i>\n" +
                                "                                                </a>\n" +
                                "                                            </td></tr>");

                            //并添加到select对象
                            $tbody.append($tr);
                        });

                    },"json");









            }
        }


    }

    $(document).ready(function() {

        loadSelect("3","pos","asff", "<s:property value="#taskQuestion.dutyPeople"/>");

        var $select = $("#pos").children();

        $select.change(function () {
            $("#duty").val($("select option:selected").text());
        });

        $("#missionText").cleditor({width:$("#boxw").width()}
        );
        var pare=window.opener;

        if(pare!=null)
        {
            var type=pare.document.getElementById("type");
            $("#type").val(type.value);

            var what=pare.document.getElementById("company");
            var index=what.selectedIndex;
            if(what!=null) {
                $("#company").text(what.options[index].text);
                $("#companyHidden").val(what.options[index].text);

            }
        }

    });


</script>
<!-- end: JavaScript-->

<!-- start: Header -->
<%@include file="header.jsp"%>
<div class="container-fluid-full">
    <div class="row-fluid">

        <!-- start: Main Menu -->
        <%@include file="mainmenu.jsp"%>
        <!-- start: Content -->
        <div id="content" class="span10">
            <ul class="breadcrumb">
                <li><i class="icon-home"></i> <a href="index.html">主页</a> <i
                        class="icon-angle-right"></i></li>
                <li><a href="#">任务情况</a></li>
            </ul>

            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header" data-original-title>
                        <h2>
                            <i class="halflings-icon white edit"></i><span class="break"></span>采购材料
                        </h2>
                        <div class="box-icon">
                            <a href="#" class="btn-setting"><i
                                    class="halflings-icon white wrench"></i></a> <a href="#"
                                                                                    class="btn-minimize"><i
                                class="halflings-icon white chevron-up"></i></a> <a href="#"
                                                                                    class="btn-close"><i class="halflings-icon white remove"></i></a>
                        </div>
                    </div>
                    <div class="box-content">
                        <form id="questionForm" class="form-horizontal" method="post" action="${pageContext.request.contextPath}/buytask_materialsaveorupdate">
                            <fieldset>

                                <input type="hidden"  name="taskMaterial.buyId" value="<s:property value="#taskBuy.id"/>">
                                <input type="hidden"  name="taskMaterial.id" value="<s:property value="#taskMaterial.id"/>">
                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*材料名称</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="materialName" name="taskMaterial.materialName"
                                               value="<s:property value="#taskMaterial.materialName"/>" type="text" placeholder="请输入材料名称">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*型号</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="model" name="taskMaterial.model"
                                               value="<s:property value="#taskMaterial.model"/>" type="text" placeholder="请输入型号">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*厂家</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="manufacturer" name="taskMaterial.manufacturer"
                                               value="<s:property value="#taskMaterial.manufacturer"/>" type="text" placeholder="请输入厂家">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*数量</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="counts" name="taskMaterial.counts"
                                               value="<s:property value="#taskMaterial.counts"/>" type="text" placeholder="请输入数量">
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*供货商地址</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="ghsdz" name="taskMaterial.ghsdz"
                                               value="<s:property value="#taskMaterial.ghsdz"/>" type="text" placeholder="请输入供货商地址">
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*供货商联系电话</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="ghsdh" name="taskMaterial.ghsdh"
                                               value="<s:property value="#taskMaterial.ghsdh"/>" type="text" placeholder="请输入供货商联系电话">
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*送货地址</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="shdz" name="taskMaterial.shdz"
                                               value="<s:property value="#taskMaterial.shdz"/>" type="text" placeholder="请输入送货地址">
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label"  style="text-align: left">*物流公司</label>
                                    <div class="controls">
                                        <input class="input-xlarge focused" id="wlgs" name="taskMaterial.wlgs"
                                               value="<s:property value="#taskMaterial.wlgs"/>" type="text" placeholder="请输入物流公司">
                                    </div>
                                </div>
                                <label class="label-warning">备注：</label>
                                <div class="control-group hidden-phone">
                                    <div class="controls" style="margin-left: auto">
                                        <textarea id="missionText" name="taskMaterial.remarks" rows="3"><s:property value="#taskMaterial.remarks"/></textarea>
                                    </div>
                                </div>

                                <div class="control-group">
                                    <label class="control-label" style="text-align: left">*采购状态</label>
                                    <div class="controls">
                                        <label class="radio">
                                            <input type="radio" name="taskMaterial.buyStatus" id="optionsRadios1" value="未采购" checked=""
                                            <s:property value="#taskMaterial.buyStatus=='未采购'?'checked':''"/>>未采购
                                        </label>
                                        <div style="clear:both"></div>
                                        <label class="radio">
                                            <input type="radio" name="taskMaterial.buyStatus" id="optionsRadios2" value="已采购"
                                            <s:property value="#taskMaterial.buyStatus=='已采购'?'checked':''"/>>已采购
                                        </label>
                                    </div>
                                </div>




                            </fieldset>
                            <div class="form-actions">
                                <button class="btn btn-primary" onclick="submitQuestion()">保存</button>
                                <button class="btn">关闭</button>
                            </div>
                        </form>



                    </div>
                </div>
                <!--/span-->

            </div>

        </div>
        <!--/.fluid-container-->

        <!-- end: Content -->
    </div>
    <!--/#content.span10-->
</div>
<!--/fluid-row-->

<%@include file="footer.jsp"%>



</body>
</html>